package com.xiguanlezz.cn;

import com.caucho.hessian.client.HessianProxyFactory;
import lombok.extern.slf4j.Slf4j;

import java.net.MalformedURLException;

/**
 * @Author：习惯了种种
 * @CreateDate：2024/10/26 16:46
 * @Description：hessian rpc的客户端实现
 */
@Slf4j
public class HessianRpcClient {

    public static void main(String[] args) throws MalformedURLException {
        HessianProxyFactory hessianProxyFactory = new HessianProxyFactory();
        String url = "http://localhost:8888/hessian-rpc/userServiceRpc";
        // 创建远端RPC服务的代理对象
        UserService userService = (UserService) hessianProxyFactory.create(UserService.class, url);
        boolean login = userService.login("xiguanlezz", "123456");
        log.debug("invoke userService#login result is {}", login);
    }
}
